# -*- coding: utf-8 -*-
# File : data_analysis.py
# Author: taoyahui
# Date : 2022/6/6
import requests
import json
api_key = '3b69725737f6f37409ad77d7ba648c6c'
# 这里面的apikey需要换成你自己的账户key
response = requests.get(f"http://api.tianapi.com/bmi/index?key={api_key}&height=185&weight=100")
text = json.loads(response.text)
news_list = text['newslist']
# print(news_list)

for news in news_list:
    print(f'bmi指数为: {news["bmi"]}')
    print(f'正常bmi指数为: {news["normbmi"]}')
    print(f'理想体重为: {news["idealweight"]}')
    print(f'健康风险值: {news["healthy"]}')
    print(f'健康提示: {news["tip"]}')